<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    window.onload = function (){
        $("myDiv").onclick = function (){
          alert("div点中");
        }
        $("clickButton").onclick = function (e){
          alert("按钮点中");
          e.stopPropagation();
        }
    }

    function  $(id){
      return document.getElementById(id);
    }

    function selectImg(){
      var reader = new FileReader();//定义文件读取流对象
      reader.readAsDataURL($("myFile").files[0]);
      reader.onload = function (ev) {
        document.getElementById("faceImg").src = ev.target.result;
      }
    }
  </script>
</head>
<body>
    <div style="width: 300px;height: 300px;border: 1px solid #000" id="myDiv">
        <input type="button" value="点击" id="clickButton">
    </div>

    <img src="" id="faceImg" width="200" height="200"><br>
    <input type="file" onchange="selectImg()" id="myFile">

</body>
</html>
